#include <cstdio>
#include <map>
#include <string>

using namespace std;
map<string, int> M;
int in_degree[2002];

int main(int argc, char const* argv[])
{
    int n;
    while (scanf("%d", &n) != EOF && n != 0) {
        for (int i = 0; i < 2 * n; i++) {
            in_degree[i] = 0;
        }
        M.clear();
        int index = 0;
        for (int i = 0; i < n; i++) {
            char str1[50], str2[50];
            scanf("%s%s", str1, str2);
            string name_a = str1, name_b = str2;
            int index_a, index_b;
            // name_a not in M
            if (M.find(name_a) == M.end()) {
                index_a = index;
                M[name_a] = index++;
            } else
                index_a = M[name_a];

            if (M.find(name_b) == M.end()) {
                index_b = index;
                M[name_b] = index++;
            } else
                index_b = M[name_b];
            in_degree[index_b]++;
        }
        int count = 0;
        for (int i = 0; i < index; i++) {
            if (in_degree[i] == 0)
                count++;
        }
        puts(count == 1 ? "Yes" : "No");
    }

    return 0;
}